<!--
 * @Descripttion: 慢直播管理—设备列表
 * @Author: wang pingqi
 * @Date: 2021-12-07 11:19:47
 * @LastEditors: wang pingqi
 * @LastEditTime: 2022-06-30 11:24:17
-->
<template>
  <div class="app-container">
    <el-form ref="listFilterRef" :model="list.filter" inline class="list-filter">
      <el-form-item prop="name">
        <el-input
          v-model="list.filter.name"
          placeholder="请输入设备名称搜索"
          clearable
        >
          <i slot="prefix" class="el-input__icon el-icon-search" />
        </el-input>
      </el-form-item>
      <el-button @click="reset">重置</el-button>
    </el-form>

    <div class="table-operation">
      <span>
        <AuthButton @click="c" name="新增" />
      </span>
      <el-pagination
        v-bind="elPaginationProps"
        :total="list.total"
        :currentPage.sync="list.filter.pageNo"
        :pageSize.sync="list.filter.pageSize"
      />
    </div>
  
    <form-item-tip
      class="mb10"
      value="该功能配置后只会在微信小程序端生效"
    />

    <el-table v-loading="list.loading" :data="list.data" v-bind="tableProp">
      <el-table-column align="center" type="index" />
      <el-table-column label="设备名称" prop="name" />
      <el-table-column label="创建时间" prop="createTime" />
      <!-- <el-table-column label="启用状态" width="80" align="center">
        <template slot-scope="{ row: { id, status } }">
          <KiPopSwitch
            v-bind="popSwitchProps(status)"
            @change="updateStatus({ id, status: status ^ 1 })"
          />
        </template>
      </el-table-column> -->
      <el-table-column align="center" label="操作">
        <template slot-scope="{ row }">
          <auth-button @click="r({ id: row.id })" name="查看" />
          <auth-button @click="u({ id: row.id })" name="编辑" />
          <auth-button @click="d({ id: row.id })" name="删除" />
        </template>
      </el-table-column>
    </el-table>

    <KiFormDialog
      :show.sync="form.show"
      :title="formTitle"
      v-model="form.data"
      :submit="submitForm"
      :readonly="form.status === 'r'"
      ref="formRef"
      :loading="form.loading"
    >
      <template #el-form>
        <el-form-item label="设备名称" prop="name" verify>
          <el-input
            v-model="form.data.name"
            clearable
            maxlength="20"
            show-word-limit
            placeholder="请输入设备名称"
          />
        </el-form-item>
        <el-form-item label="拉流地址" prop="pullUrl" verify>
          <el-input
            v-model="form.data.pullUrl"
            clearable
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 4}"
            maxlength="300"
            show-word-limit
            placeholder="请输入拉流地址"
          />
        </el-form-item>
        <el-form-item label="备注说明" prop="remark">
          <el-input
            v-model="form.data.remark"
            clearable
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 4}"
            maxlength="100"
            show-word-limit
            placeholder="请输入备注说明"
          />
        </el-form-item>
      </template>
    </KiFormDialog>
  </div>
</template>

<script>
import pageMixin from '@/utils/pageMixin'
import useAdmateAdapter from '@/utils/useAdmateAdapter'

export default {
  mixins: [pageMixin],
  setup: () =>useAdmateAdapter({
    urlPrefix: 'one-travel-api/slowlive/equipment'
  })
}
</script>

<style lang="scss" scoped>
</style>

